<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            color: #fff;
            font: 12px/1.5 "微软雅黑";
        }

        #div1 {
            width: 150px;
            height: 150px;
            margin: 0 auto;
            padding: 10px;
            background: tan;
            border: 10px solid #000;
            cursor: crosshair;
        }

        #div1.hover {
            color: olive;
            background: orange;
            border: 10px solid red;
        }
    </style>
    <script>
        window.onload = function () {
            var div = document.getElementById("div1");
            div.onmouseover = function () {
                div.className = 'hover'
            };
            div.onmouseout = function(){
                div.className = ''
            }
        }
    </script>
</head>

<body>
    <div id="div1">鼠标移入改变样式，鼠标移出恢复。</div>
</body>

</html>